/**
 * Copyright 2011 Brigham Young University
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.byu.nlp.util;

/**
 * A class that represents a two-tuple of items. Use sparingly, as custom classes are typically preferred.
 * 
 * @author rah67
 *
 */
public class Pair<F, S> {
	
	private F first;
	private S second;
	
	public Pair(F first, S second) {
		this.first = first;
		this.second = second;
	}
	
	public F getFirst() { return first; }
	public S getSecond() { return second; }
	
	public void setFirst(F first) { this.first = first; }
	public void setSecond(S second) { this.second = second; }
	public void setBoth(F first, S second) {
		this.first = first;
		this.second = second;
	}
	
	/**
	 * Creates a pair. Convenient factory method that helps reduce the number of generics needed in many cases.
	 */
	public static <F, S> Pair<F, S> of(F first, S second) {
		return new Pair<F, S>(first, second);
	}
}
